class Comment < ActiveRecord::Base
  set_table_name 'comment'
  set_primary_key 'comment_id'

  belongs_to :project,
             :class_name  => 'Project',
	     :foreign_key => 'project_fk'; 

  belongs_to :user,
             :class_name  => 'User',
	     :foreign_key => 'user_fk';

  belongs_to :task,
             :class_name  => 'Task',
             :foreign_key => 'task_fk'; 
 
  validates_presence_of :content, :user_fk, :project_fk, :added;	


  # get comment
  # returns the comment based on comment id
  
  def self.get_comment(comment_id)
      return nil unless comment_id; # sane verification
      return find(:first,
                  :conditions => ["comment_id = ?", comment_id]);
  end
end
